package com.coscon.rebatesharing.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import utils.JSONUtils;

import com.coscon.rebatesharing.bean.TestBean;

@Controller
public class TestController {
	
	@RequestMapping(value = "testDataTable.do")
	public @ResponseBody Map<String, Object> testDataTable(String start, String length, String query, String order){
		
		Map<String, Object> result = new HashMap<String, Object>();
		
		List<Map<String, Object>> orderBy = JSONUtils.toList(order);
		Map<String, Object> queryCondition = JSONUtils.toHashMap(query);
		
		List<TestBean> ds = new ArrayList<TestBean>();
		for (int i = 0; i < 10; i++) {
			ds.add(new TestBean(i+"", "msg"+i));
		}
		
		
		result.put("recordsTotal", 20);
		result.put("recordsFiltered", 20);
		result.put("data", ds);
		result.put("query", queryCondition);
		
		return result;
	}
}
